package org.fastsyncer.common.entity;

import java.io.Serializable;

/**
 * Rest请求响应对象
 * @author YangPei
 * @date 2017年3月30日 下午2:26:19
 * @version 4.0
 */
public class RestResult implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 请求是否成功
     */
    private boolean success;

    /**
     * 请求成功后返回的结果数据
     */
    private Object resultValue;

    /**
     * 请求失败返回提示信息
     * @param resultHint提示信息
     * @return RestResult
     */
    public static RestResult restFail(Object resultValue) {
        return new RestResult(false, resultValue);
    }

    /**
     * 请求成功返回结果数据
     * @param resultValue请求结果数据
     * @return RestResult
     */
    public static RestResult restSuccess(Object resultValue) {
        return new RestResult(true, resultValue);
    }
    
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public Object getResultValue() {
        return resultValue;
    }

    public void setResultValue(Object resultValue) {
        this.resultValue = resultValue;
    }

    public RestResult() {

    }

    public RestResult(boolean success, Object resultValue) {
        super();
        this.success = success;
        this.resultValue = resultValue;
    }

    @Override
    public String toString() {
        return "RestResult [success=" + success + ", resultValue=" + resultValue + "]";
    }

}
